package com.cloud.pole.param.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.cloud.pole.common.msg.ObjectRestResponse;
import com.cloud.pole.common.rest.BaseController;
import com.cloud.pole.param.biz.PickListBiz;
import com.cloud.pole.param.model.entity.Picklist;

import lombok.extern.slf4j.Slf4j;

/**
 * 
* <p>Title: PickListController</p>  
* <p>Description: 数据字典前端控制器</p>  
* @author hsg  
* @date 2019年1月17日
 */
@Controller
@RequestMapping("picklist/admin")
@Slf4j
public class PickListAdminController extends BaseController<PickListBiz,Picklist> {
	
	@Autowired
	private PickListBiz pickListBiz;
	
	@RequestMapping(value = "/getPicklist/{picklistCode}", method = RequestMethod.GET)
	@ResponseBody
	public ObjectRestResponse<Picklist> getPicklist(@PathVariable String picklistCode) {
	    List<Picklist> picklist = pickListBiz.getPicklistByCode(picklistCode);
	    return new ObjectRestResponse<List<Picklist>>().data(picklist);
	}
	
	@ResponseBody
	@GetMapping("getParamPicklist")
	public ObjectRestResponse<Picklist> getPicklistText() {
		List<Picklist> paramPicklists = pickListBiz.paramPicklists();
		return new ObjectRestResponse<List<Picklist>>().data(paramPicklists);
	}

	@ResponseBody
	@GetMapping("getCashPayment")
	public ObjectRestResponse<Picklist> getPickCashPayment() {
		
		List<String> strS = new ArrayList<String>();
		strS.add("126");
		strS.add("127");
		List<Picklist> pickListTexts = pickListBiz.pickListTexts(strS);
		return new ObjectRestResponse<List<Picklist>>().data(pickListTexts);
	}

	@ResponseBody
	@GetMapping("getCashPaymentStages")
	public ObjectRestResponse<Picklist> getCashPaymentStages() {
		List<String> strS = new ArrayList<String>();
		strS.add("123");
		List<Picklist> pickListTexts = pickListBiz.pickListTexts(strS);
		return new ObjectRestResponse<List<Picklist>>().data(pickListTexts);
	}
}
